package main

import (
	"github.com/tarm/serial"
	"os"
	"parking/src/common"
	"parking/src/structs"
	"time"
)

func getEnv(key, defaultValue string) string {
	if value, exists := os.LookupEnv(key); exists {
		return value
	}
	return defaultValue
}

var (
	localStorePath = getEnv("localStorePath", "/parking/pictures/") // Linux 默认值
	serialNumber   = getEnv("serialNumber", "b06835cbdfd714a9")
	configPath     = getEnv("configPath", "/")
	configName     = getEnv("configName", "config.json")
)

// 相机相关配置信息
var camerasInfoMap = make(map[string]*structs.CameraInfoStruct)
var camerasTimerMap = make(map[string]time.Time)

// led485连接Map
var led485InfoList []*structs.Led485ConfigStruct
var led485ConnMap = make(map[string]*serial.Port)

// 离线模式相关配置
var errorShows *structs.ErrorShows
var offlineOpen int

var cameraHeartbeatInterval time.Duration
var deviceHeartbeatInterval = 60 * time.Second

// 第三方日志记录器 zap
var logger = common.GetLogger()
